import { Catch } from '@midwayjs/decorator';
import { Context } from '@midwayjs/koa';
import { ResponseError } from '../error/response_error';

@Catch(ResponseError)
export class ResponseErrorFilter {
  async catch(err: ResponseError, ctx: Context) {
    ctx.body = { code: err.msgcode, message: err.message };
  }
}
